package com.bookkeeping.bookkeepingapi.service.dto;

import com.bookkeeping.bookkeepingapi.model.BookKeep;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BookKeepDto {
    private Integer bookKeepId; //记账ID

    private LocalDateTime addTime; //添加时间

    private LocalDateTime updateTime; //更新时间

    private LocalDate bookKeepDate;//0 支出 1收入

    private Integer type;//0 支出 1收入

    private  String category;//分类

    private BigDecimal price;//价格

    private  String  remark;//备注

    private UserDto user;//用户id

    public BookKeepDto(BookKeep bookKeep){
        this.bookKeepId = bookKeep.getId();
        this.addTime = bookKeep.getAddTime();
        this.updateTime = bookKeep.getUpdateTime();
        this.bookKeepDate= bookKeep.getBookKeepDate();
        this.type = bookKeep.getType();
        this.category = bookKeep.getCagegory();
        this.price = bookKeep.getPrice();
        this.remark = bookKeep.getRemark();
        this.user = new UserDto(bookKeep.getUser());
    }
}
